package com.chapter2.sort;

/** 
 * @ClassName: SortApp 
 * @Description: 排序程序
 * @author minjun minjun@bw30.com
 * @date 2015-2-13 下午11:08:47 
 *  
 */
public class SortApp {

	private Sortable sortable;
	
	private int[] array;

	public SortApp(Sortable sortable,int[] array) {
		this.sortable=sortable;
		this.array=array;
	}
	
	public void sort(){
		long start=System.nanoTime();
		sortable.sort(array);
		long end=System.nanoTime();
		System.out.println((end-start)/1000.0+"time");
	}
	
	public void print(){
		sortable.print(array);
	}
	
	public void confirmSorted(){
		if(sortable.isSorted(array)) System.out.println("已排序完成");
		else System.out.println("还未排序完成");
	}
	
}
